package Janelas;
import java.awt.Dimension;
import java.awt.Toolkit;
import submissao.ConexaoBD;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JanelaInicial.java
 *
 * Created on 27/10/2010, 22:50:36
 */

/**
 *
 * @author Vitor
 */
public class JanelaInicial extends javax.swing.JFrame {

    /** Creates new form JanelaInicial */
    public JanelaInicial(ConexaoBD conexao) {
        this.conexao = conexao;

        initComponents();
        this.setTitle("Sistema de Submissão de Documentos Científicos");
        Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
	int alturaTela = d.height;
	int comprimentoTela = d.width;
	setLocation((comprimentoTela)/4, (alturaTela)/4);
	this.setResizable(false);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        bSubmeteDocumento = new javax.swing.JButton();
        bConsulta = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        bSubmeteDocumento.setText("Submeter Documento");
        bSubmeteDocumento.setToolTipText("Submeter Documentos");
        bSubmeteDocumento.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                trataCliqueMouseSubmeteDocumentos(evt);
            }
        });
        bSubmeteDocumento.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bSubmeteDocumentoActionPerformed(evt);
            }
        });

        bConsulta.setText("Consultar Artigos");
        bConsulta.setToolTipText("Consultar Artigos");
        bConsulta.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                trataCliqueMouseConsulta(evt);
            }
        });
        bConsulta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bConsultaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(111, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(bConsulta)
                    .addComponent(bSubmeteDocumento))
                .addGap(106, 106, 106))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {bConsulta, bSubmeteDocumento});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(bSubmeteDocumento, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(bConsulta)
                .addContainerGap(66, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {bConsulta, bSubmeteDocumento});

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void bSubmeteDocumentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bSubmeteDocumentoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_bSubmeteDocumentoActionPerformed

    private void bConsultaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bConsultaActionPerformed
         // TODO add your handling code here:
    }//GEN-LAST:event_bConsultaActionPerformed

    private void trataCliqueMouseConsulta(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_trataCliqueMouseConsulta
        // TODO add your handling code here:
        ConsultaArtigos consulta = new ConsultaArtigos();
        consulta.setVisible(true);
    }//GEN-LAST:event_trataCliqueMouseConsulta

    private void trataCliqueMouseSubmeteDocumentos(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_trataCliqueMouseSubmeteDocumentos
        // TODO add your handling code here:
        SubmeteDocumentos submete = new SubmeteDocumentos(conexao);
        submete.setVisible(true);
    }//GEN-LAST:event_trataCliqueMouseSubmeteDocumentos


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bConsulta;
    private javax.swing.JButton bSubmeteDocumento;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables
    private ConexaoBD conexao;
}
